<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>2.2. odtone::sap::user Class Reference</title>
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../../../index.html" title="ODTONE 0.3">
<link rel="up" href="../index_sap.html" title="ODTONE SAP">
<link rel="prev" href="odtone_sap_class.html" title="2.1. odtone::sap::sap Class Reference">
<link rel="next" href="odtone_sap_link_class.html" title="2.3. odtone::sap::link Class Reference">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="'ODTONE - Open Dot Twenty One'" width="100" height="100" src="../../.././images/logo.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="odtone_sap_class.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index_sap.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="odtone_sap_link_class.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
</div>
<div class="section" title="2.2. odtone::sap::user Class Reference">
<div class="titlepage"><div><div><h4 class="title">
<a name="odtone.library.index_sap.odtone_sap_user_class"></a><a class="link" href="odtone_sap_user_class.html" title="2.2. odtone::sap::user Class Reference"> 2.2.
        odtone::sap::user Class Reference</a>
</h4></div></div></div>
<a name="odtone.library.index_sap.odtone_sap_user_class.detailed_description"></a><h6>
<a name="id3094299"></a>
          <a class="link" href="odtone_sap_user_class.html#odtone.library.index_sap.odtone_sap_user_class.detailed_description">Detailed
          Description</a>
        </h6>
<p>
          <span class="inlinemediaobject"><img src="./../../../images/odtone::sap::user.png" alt="odtone::sap::user"></span>
        </p>
<p>
          <span class="bold"><strong>User SAP IO Service</strong></span>
        </p>
<p>
          This module handles the communication between User SAP implementations
          and the MIHF. After being initialized it must be running by invoking the
          run() method of the provided boost::asio::io_service.
        </p>
<p>
          It is necessary to define handle routines that will be called when a message
          is received or sent. This offers a simple mechanism to process received
          message and to report the success or failure in delivering a sent message.
        </p>
<a name="odtone.library.index_sap.odtone_sap_user_class.namespace"></a><h6>
<a name="id3094363"></a>
          <a class="link" href="odtone_sap_user_class.html#odtone.library.index_sap.odtone_sap_user_class.namespace">Namespace</a>
        </h6>
<p>
          
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">odtone</span><span class="special">::</span><span class="identifier">sap</span>
</pre>
<p>
        </p>
<a name="odtone.library.index_sap.odtone_sap_user_class.public_member_functions"></a><h6>
<a name="id3094417"></a>
          <a class="link" href="odtone_sap_user_class.html#odtone.library.index_sap.odtone_sap_user_class.public_member_functions">Public
          Member Functions</a>
        </h6>
<p>
          
</p>
<pre class="programlisting"><span class="identifier">user</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mih</span><span class="special">::</span><span class="identifier">config</span><span class="special">&amp;</span> <span class="identifier">cfg</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">io_service</span><span class="special">&amp;</span> <span class="identifier">io</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">handler</span><span class="special">&amp;</span> <span class="identifier">h</span><span class="special">);</span>
<span class="special">~</span><span class="identifier">user</span><span class="special">();</span>
<span class="keyword">void</span> <span class="identifier">async_send</span><span class="special">(</span><span class="identifier">mih</span><span class="special">::</span><span class="identifier">message</span><span class="special">&amp;</span> <span class="identifier">pm</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">handler</span><span class="special">&amp;</span> <span class="identifier">h</span><span class="special">);</span>
<span class="keyword">void</span> <span class="identifier">sync_send</span><span class="special">(</span><span class="identifier">mih</span><span class="special">::</span><span class="identifier">message</span><span class="special">&amp;</span> <span class="identifier">msg</span><span class="special">);</span>
</pre>
<p>
        </p>
<a name="odtone.library.index_sap.odtone_sap_user_class.constructor__amp__destructor_documentation"></a><h6>
<a name="id3094687"></a>
          <a class="link" href="odtone_sap_user_class.html#odtone.library.index_sap.odtone_sap_user_class.constructor__amp__destructor_documentation">Constructor
          &amp; Destructor Documentation</a>
        </h6>
<p>
          
</p>
<pre class="programlisting"><span class="identifier">user</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">mih</span><span class="special">::</span><span class="identifier">config</span><span class="special">&amp;</span> <span class="identifier">cfg</span><span class="special">,</span>
     <span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">io_service</span><span class="special">&amp;</span> <span class="identifier">io</span><span class="special">,</span>
     <span class="keyword">const</span> <span class="identifier">handler</span><span class="special">&amp;</span> <span class="identifier">h</span><span class="special">);</span>
</pre>
<p>
        </p>
<p>
          Construct an User SAP IO Service.
        </p>
<p>
          The handler callback is invoked when an message is received, offering a
          simple way to process incoming messages.
        </p>
<p>
          The signature of the callback is:
        </p>
<p>
          
</p>
<pre class="programlisting"><span class="keyword">void</span><span class="special">(</span><span class="identifier">odtone</span><span class="special">::</span><span class="identifier">mih</span><span class="special">::</span><span class="identifier">message</span><span class="special">&amp;,</span> <span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span><span class="special">&amp;)</span>
</pre>
<p>
        </p>
<p>
          <span class="bold"><strong>Parameters:</strong></span>
        </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<span class="bold"><strong>cfg</strong></span> - configuration with the parameters
            for MIH User port, MIHF ip:port and receive
          </li>
<li class="listitem">
<span class="bold"><strong>io</strong></span> - generic IO service
          </li>
<li class="listitem">
<span class="bold"><strong>h</strong></span> - handler callback as a function pointer/object
          </li>
</ul></div>
<p>
          <span class="bold"><strong>Throws:</strong></span>
        </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
            boost::system::error_code
          </li></ul></div>
<p>
          <span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span>
        </p>
<p>
          
</p>
<pre class="programlisting"><span class="special">~</span><span class="identifier">user</span><span class="special">();</span>
</pre>
<p>
        </p>
<p>
          Destructor for User SAP IO Service.
        </p>
<p>
          <span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span>
        </p>
<a name="odtone.library.index_sap.odtone_sap_user_class.member_function_documentation"></a><h6>
<a name="id3095248"></a>
          <a class="link" href="odtone_sap_user_class.html#odtone.library.index_sap.odtone_sap_user_class.member_function_documentation">Member
          Function Documentation</a>
        </h6>
<p>
          
</p>
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">async_send</span><span class="special">(</span><span class="identifier">mih</span><span class="special">::</span><span class="identifier">message</span><span class="special">&amp;</span> <span class="identifier">p</span><span class="special">,</span>
                   <span class="keyword">const</span> <span class="identifier">handler</span><span class="special">&amp;</span> <span class="identifier">h</span> <span class="special">=</span> <span class="identifier">handler</span><span class="special">());</span>
</pre>
<p>
        </p>
<p>
          Send the MIH message to the local MIHF asynchronously.
        </p>
<p>
          After the message is sent, the callback is called with the response message
          or to report failure in delivering the message to the MIHF.
        </p>
<p>
          This method returns immediately.
        </p>
<p>
          <span class="bold"><strong>Parameters:</strong></span>
        </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<span class="bold"><strong>msg</strong></span> - MIH message to send
          </li>
<li class="listitem">
<span class="bold"><strong>h</strong></span> - completion/response callback handler
            as a function pointer/object
          </li>
</ul></div>
<p>
          <span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span><span class="underline">_</span>
        </p>
<p>
          
</p>
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">sync_send</span><span class="special">(</span><span class="identifier">mih</span><span class="special">::</span><span class="identifier">message</span><span class="special">&amp;</span> <span class="identifier">msg</span><span class="special">);</span>
</pre>
<p>
          Send the MIH message to the local MIHF synchronously. After the message
          is sent, the callback is called to report the success or failure in delivering
          the message to the MIHF. This method retuns immediately.
        </p>
<p>
          <span class="bold"><strong>Parameters:</strong></span>
        </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<span class="bold"><strong>msg</strong></span> - MIH message to send
          </li></ul></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2009 -2011 Universidade Aveiro<br>Copyright &#169; 2009 -2011 Instituto de Telecomunica&#231;&#245;es - P&#243;lo Aveiro<p>
        This software is distributed under a license. The full license agreement
        can be found in the LICENSE in this distribution. This software may not be
        copied, modified, sold or distributed other than expressed in the named license
        agreement. This software is distributed without any warranty.
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="odtone_sap_class.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index_sap.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="odtone_sap_link_class.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
</div>
</body>
</html>
